home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 2421 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: cs.tu-berlin.de!news
  2. From: Ingo Meneikis <meneikis@cs.tu-berlin.de>
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: silly c problem
  5. Date: Wed, 31 Jan 1996 11:55:36 +0100
  6. Organization: TU Berlin
  7. Message-ID: <310F4AA8.63E6@cs.tu-berlin.de>
  8. References: <f2c_9601302132@techtol.magic.mb.ca>
  9. NNTP-Posting-Host: malaria.cs.tu-berlin.de
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=iso-8859-2
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b5 (X11; I; SunOS 5.4 sun4m)
  14.  
  15. Tahir Khawaja wrote:
  16. >   scanf("%d%d", &num1, &num2);
  17.                 ^      ^       - O.K.
  18. >   printf("You entered %d and %d.\n\n", &num1, &num2);
  19.                                          ^      ^
  20. You want to type out the addresses of the int variables!
  21. For scanf it's o.k. - here you have to give the addresses of
  22. the variables, you want to scan in. Because C doesn't support
  23. call by reference. (Pascal : VAR INTEGER x )
  24. But for printf, there you have to give the variable names as 
  25. argument! printf doesn't give back any values except the return value.
  26.  
  27. >     printf("The result is %d %d %d %d\n.", &num1, &num2, &res, &err);
  28.                                              ^      ^      ^     ^
  29.                                              see above
  30.  
  31.  
  32. Hope I could help you.
  33.  
  34. And hope you understand my English.
  35.  
  36.             Ingo
  37.